import React, { useContext } from 'react';
import { Input } from 'antd';
import { StatusContext } from '@/views/MaterialsView/context';

interface EditorProps {
  configKey: string;
  id: string;
  status: string;
  isShow: boolean;
  editCom: React.FC<any>; // 假设editCom是一个React组件类型
}

const DescEditor: React.FC<EditorProps> = ({ configKey, id, status }) => {
  // const [text, setText] = useState(status);
  const { updateStatus } = useContext(StatusContext);
  const inputHandle = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
    const val = e.target.value;
    // setText(val);
    if (updateStatus) {
      updateStatus(configKey, val);
    }
  };

  return (
    <div key={id}>
      <div className="m-b-2">描述内容</div>
      <Input.TextArea value={status} onChange={inputHandle} placeholder="请输入描述" rows={4} />
    </div>
  );
};

export default DescEditor;
